home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / EOT.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  1.5 KB  |  45 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import symjava.sql.SQLException;
  7.  
  8. class EOT extends ServerObject {
  9.    int _length;
  10.    String _trailer;
  11.  
  12.    EOT(String trailer) {
  13.       this._trailer = trailer;
  14.       this._length = this._trailer.length() > 4 ? 4 : (short)this._trailer.length();
  15.    }
  16.  
  17.    EOT() {
  18.       this._trailer = new String("");
  19.       this._length = 0;
  20.    }
  21.  
  22.    int getType() {
  23.       return 50;
  24.    }
  25.  
  26.    void read(DataInputStream in) throws SQLException, IOException, ErrorException {
  27.       this._length = in.readShort();
  28.       if (this._length > 0) {
  29.          byte[] b = new byte[this._length];
  30.          in.readFully(b, 0, this._length);
  31.          this._trailer = new String(b, 0);
  32.       }
  33.  
  34.    }
  35.  
  36.    void write(DataOutputStream out) throws IOException {
  37.       out.writeByte(this.getType());
  38.       out.writeShort(this._length);
  39.       if (this._length > 0) {
  40.          out.writeChars(this._trailer);
  41.       }
  42.  
  43.    }
  44. }
  45.